package com.ly.ymall.manager.service.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.ly.ymall.manager.dao.BaseCatalog1Mapper;
import com.ly.ymall.manager.dao.BaseCatalog2Mapper;
import com.ly.ymall.manager.dao.BaseCatalog3Mapper;
import com.ly.ymall.pojo.BaseCatalog1;
import com.ly.ymall.pojo.BaseCatalog2;
import com.ly.ymall.pojo.BaseCatalog3;
import com.ly.ymall.service.CatalogService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

/**
 * @Auther: LIMING
 * @Date: 2019/2/27 19:35
 * @Description:
 */
@Service
public class CatalogServiceImpl implements CatalogService {

    @Autowired
    BaseCatalog1Mapper baseCatalog1Mapper;

    @Autowired
    BaseCatalog2Mapper baseCatalog2Mapper;

    @Autowired
    BaseCatalog3Mapper baseCatalog3Mapper;

     @Override
   public List<BaseCatalog1> getCatalog1List() {

        EntityWrapper<BaseCatalog1> wrapper = new EntityWrapper<>();
        List<BaseCatalog1> catalog1List = baseCatalog1Mapper.selectList(wrapper);
        return catalog1List;
    }

    @Override
    public List<BaseCatalog2> getCatalog2List(Integer catalog1Id) {

        EntityWrapper<BaseCatalog2> wrapper = new EntityWrapper<>();
        wrapper.eq("catalog1_id",catalog1Id);
        List<BaseCatalog2> catalog2List = baseCatalog2Mapper.selectList(wrapper);
        return catalog2List;
    }

    @Override
    public List<BaseCatalog3> getCatalog3List(Integer catalog3Id) {
        EntityWrapper<BaseCatalog3> wrapper = new EntityWrapper<>();
        wrapper.eq("catalog2_id",catalog3Id);
        List<BaseCatalog3> catalog3List = baseCatalog3Mapper.selectList(wrapper);
        return catalog3List;
    }
}
